package com.ds.infrastructure.hyperspace.console.model.request.log;

import com.ds.infrastructure.hyperspace.console.config.validation.EnumValue;
import com.ds.infrastructure.hyperspace.console.entity.enums.TbNodeExecuteLogEnum;
import com.ds.infrastructure.hyperspace.console.entity.enums.TbPublicEnum;
import com.ds.infrastructure.hyperspace.console.entity.table.TbNodeExecuteLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @author: yaozhendong
 * @create: 2019-10-28 16:17
 **/
@Data
@NoArgsConstructor
public class ListLogForm {
    @NotNull
    Long taskId;

    @ApiModelProperty(value = "TASK_TYPE类型:1=网关配置发送任务;2=部署-安装任务;3=部署-激活任务;", example = "1")
    @EnumValue(value = TbNodeExecuteLogEnum.TASK_TYPE.class)
    Integer taskType;

    public static TbNodeExecuteLog toEntity(ListLogForm form) {
        TbNodeExecuteLog tbNodeExecuteLog = new TbNodeExecuteLog();
        tbNodeExecuteLog.setTaskId(form.getTaskId());
        tbNodeExecuteLog.setTaskType(form.getTaskType());
        tbNodeExecuteLog.setGmtIsDeleted(TbPublicEnum.GMD_IS_DEL.NO.code);
        return tbNodeExecuteLog;
    }
}
